Event Assembler Language
DISCLAIMER: All insults are used as jokes and are not supposed to offend anyone. If you, however, still feel that you are offended, feel free to rant in some hidden corner of the Internet as much as you want. Comments: /**/ = Ingores everything between the **'s. Example: MNCH /*Coment!!!11!!*/ 0x55 will look the same to the assembler as: MNCH 0x55 // = Ingores the rest of the line Example: MNCH 0x55 //lol commentz!!11!! noob, ?!?!?!?!??!?!??!??! orly stfu u suck will look the same to the assembler as: MNCH 0x55 / at the end if line = fuses the current and next line into one. Example: #define DoubleENDA ENDA; / ENDA will look the same to the assembler as: #define DoubleENDA ENDA; ENDA Using labels: If a lines first word ends with :, it is considered as a label. A label can be followed by normal code. The part before : is the labels name. Example: randomName: Label can be used in the code by placing it's name as the pointer parameter. Example: POIN randomName Hex/dec/bin numbers. Hex number must ALWAYS start with either 0x or $. Binary numbers end with b or B. Othervise, the number will be interpretetted as dec. Letters in dec numbers will cause errors and values other than 0 and 1 will cause errors bin numbers. 0x and $ are the same unless specified othervise. Defining stuff: You can define a piece of text to mean something else with #define. First parameter is the text that you are giving meaning to and the second is the real value. Note that using defined things as the real value causes problems. Example: #define Eliwood 1 This can be then used in your code like this: IFCA 15 Eliwood Definition files: #define file *file path* The define files themselves are like this: 0x01 Eliwood EliwoodLord IronSword 0x02 Hector LynLord SlimSword This defines Eliwood, EliwoodLord and IronSword as values 1 and Hector, LynLord and SlimSword as values 2. Undefining: You can use #undef to undefine something defined with #define. Attempting to undefine something that hasn't been defined is ignored. Checking if something is defined: With #ifdef and #ifndef, you can check if something is defined or not. #endif must be used to sign an end of #if check. #else can be used between #if and #endif to react for opposite result. #if's can stack. Automatically defined stuff: Event assembler automatically defines _EA_. It also defines either _FE6_, _FE7_ or _FE8_ depending on the selected game. Undefining or defining any of these leads to undefined behaviour. Including other files: Using #include *filePath* you can include extra code and variable definitions from other files into this. Including a binary file: You can include a binary file amongst the event assembly with #incbin *file path*. This will copy all data from the file into the part of the code where #incbin is used. Changing the offset: Using ORG *offset* you can change the offset the code is compiled into. Note that if this isn't used, the compiler automatically starts to compile the code to offset 0, which will break the ROM utterly. Aligning offset: Using ALIGN *value* you can align the offset to the value. Most codes require an alignment of 4, so if you get an error about offset not being divisible by a value, use ALIGN before that code to fix the error. Using double quotes: Surrouding text with "" allows you to force them as single parameter for preprosessor. In the actual code, they will be treated as normal characters. Several codes on one line lines: Adding ; to somewhere to a line will make assembler consider the text after ; as a new code instead of parameters of the old code. Note that line can have as many ; as you want. Macros: Macros are defined as anything else, except they take parameters too. Example: #define Sieze(eventID,offset,X,Y) "LOCA eventID offset X,Y 0xF" Separate parameters are separated by , in the macro definition. After definition, the macro can be then used in the code like this: Sieze(0x20,Sieze_Your_Mom,2,33) And that will look to assembler like this: LOCA 0x20 Sieze_Your_Mom 2,33 0x0F Arithmetics aka calculating aka math: The following operations are supported: +, -, *, /, %, &, |, ^ Dividing with zero naturally causes problems. The following operations are being included, so don't use them as part of names or codes: !, -, ~ Spelling mistakes: Misspellers will be punished. Muhahahahahahahahaaaaaaaaa!!!!1111!!!!! ---------------------------------------- ----------------Codes------------------- ---------------------------------------- Turn based events. TURN 0xPP $pointer XX,YY 0xZ 0xMM PP = event identifier XX = starting turn YY = ending turn+1 Z = 0 beginning of player phase Z = 8 beginning of enemy phase MM=mode 01=ENM 02=HNM 03=EHM 04=HHM, FE7 only Character based events. CHAR 0xPP $pointer 0xAA 0xÄÄ 0xMM PP = event identifier AA = character1 ÄÄ = character2 MM = 1, eliwood MM = 2, hector MM = 00XX0003, if event XX has happened, for FE7 and FE8 only Location based events. LOCA 0xPP $pointer XX,YY 0xZZ VILL 0xPP $pointer XX,YY 0xZZ SHOP 0xPP $pointer XX,YY 0xZZ CHES 0xPP $chest data XX,YY 0xZZ DOOR 0xPP $pointer XX,YY 0xZZ PP = event identifier XX,YY = Coordinate of the event ZZ = Command to use. NOTE: for SHOP, the pointer points to a shop list that determines what does the shop sell. NOTE 2: VILL forces a map change to happen NOTE 3: Chest data determines the item or amount of money you get from a chest. Exact usage is game specific. Shop list. SHLI 0xI1 0xI2 0xI3 0xI1,2,3... = item. Area events. AREA 0xPP $pointer X1,Y1 X2,Y2 X1,Y1 = upper left corner of trigger area X2,Y2 = lower right corner of trigger area Event after another event. AFEV 0xPP *pointer* 0xRR 0xRR = The event ID of previous event. Event if ASM condition is fulfilled ASME 0xPP *pointer* *ASM pointer* ASM pointer = pointer to ASM code Unit data FE7 and FE6: UNIT 0xZZ 0xCC 0xLC 0xLL X1,Y1 X2,Y2 I1 I2 I3 I4 A1 A2 A3 A4 UNIT 0xZZ 0xCC 0xLC 0xLL X1,Y1 X2,Y2 *Items* *AI* UNIT 0xZZ 0xCC 0xLC 0xLL X1,Y1 X2,Y2 I1,I2,I3,I4 A1,A2,A3,A4 ZZ = Character CC = Class LC = Leader character LL = Starting level X1,Y1 = Loading coordinate X2,Y2 = Starting coordinate I1 I2 I3 I4 or *Items* = Starting inventory A1 A2 A3 A4 or *AI* = Units artificial intelligence Unit data FE8: UNIT 0xZZ 0xCC 0xLC 0xLL XX,YY *Flags* *Byte1* *Amount* *Reinforment pointer* I1 I2 I3 I4 A1 A2 A3 A4 UNIT 0xZZ 0xCC 0xLC 0xLL XX,YY *Flags* *Byte1* *Amount* *Reinforment pointer* *Items* *AI* UNIT 0xZZ 0xCC 0xLC 0xLL XX,YY *Flags* *Byte1* *Amount* *Reinforment pointer* I1,I2,I3,I4 A1,A2,A3,A4 ZZ = Character CC = Class LC = Leader character LL = Starting level XX,YY = Loading coordinate Flags = Flags like making units last item droppable or being Valni template Byte1 = Unknown, probably unused Amount = amount of pointed reinforment data Reinforment pointer = pointer to reinforcement data I1 I2 I3 I4 or *Items* = Starting inventory A1 A2 A3 A4 or *AI* = Units artificial intelligence Reinforcement data REDA XX,YY 0xSS 0xRR 0xDD X,Y = position to move to SS = speed to move RR = character rescuing this unit DD = delay before executing this data Ballistae's BLST XX,YY *Ballista type* Showing text. TEX# 0xZZZZ ZZZZ=text value //# - code //1 - 0d //2 - 0e //3 - 0f //4 - 11 //5 - cf TEX6 0xGG XX,YY 0xZZZZ GG = text background. XX,YY = position of text. ZZZZ=text value TEX8 0xZZZZ XX,YY Show small brown textbox ZZZZ = text value XX,YY = position of the textbox RETB Hide brown text-box TEXTSTART Go to text showing mode. TEXTSHOW 0xZZZZ Show text in text showing mode. ZZZZ=text value TEXTCONT Show more text. TEXTEND Get out of text showing mode. Makes event ID usable. ENUT 0xNN Makes event ID used. ENUF 0x00 NN = event number Condition related codes. Turn condition IFTU 0xII 0xTT Event condition IFEV 0xII 0xVV Previous yes/no statement IFYN 0xII Checks for Eliwood mode IFEM 0xII Checks for tutorial mode IFTT 0xII Unit is Fielded IFUF 0xII 0xXX Checks for active character IFCA 0xII 0xXX Checks if character is dead (or recruited?) IFCD 0xII 0xXX ASM conditioon is true (returns non 0 value in r0) IFAT 0xII *pointer* ASM conditioon is false (returns 0 in r0) IFAF 0xII *pointer* End of if statement ENIF 0xII Else statement ELSE 0xII II = condition identifier VV = Event number TT = Turn number Change weather. WEA1 0xZZ WEA2 0xZZ ZZ=Weather Load units. LOU1 $pointer (repeatable) LOU2 $pointer (repeatable) LOU3 $pointer (repeatable) LOU4 $ENM pointer $EHM pointer $HNM pointer $HHM pointer LOEV 0xZZ 0xPP XX,YY ZZ = Character PP = Class XX,YY = coordinate to load into. Move units on map. MOVE X1,Y1 X2,Y2 MOVE X1,Y1 X2,Y2 0xGG MOVE X1,Y1 *pointer To Move Manual* MOVE 0xZZ XX,Y2 MOVE 0xZZ XX,Y2 0xGG MOVE 0xZZ *pointer To Move Manual* X1,Y1 = Starting coordinate X2,Y2 = Ending coordinate ZZ = Character GG = Speed of moving Move manual MOMA up/down/left/right/highlight(Y)/notice/speed(Z) Y = amount of time to highlight 0-0x7F Z = speed to change to End unit load or/and move event ENUN End of an event ENDA ENDB (before preparations screen) End chapter and transfer to next one MNCH 0xYY MNC2 0xYY (skips world map) YY = Chapter number. Stall. STAL 0xZZ (repeatable) ZZ=time to stall Move camera on map. CAM1 0xZZ CAM1 XX,YY CAM2 XX,YY //1F ZZ=character XX,YY = Character Changges vision distance VCBF 0xZZ (black fog) VCWF 0xZZ (white fog) ZZ = vision distance 00 = infinite Changes/puts up a convo background BACG 0xZZ ZZ=background Shows a CG picture SHCG XX XX = picture value return to map REMA Changes music MUS1 0xZZ MUS2 0xZZ MUS3 0xZZ ZZ=music value Makes sound effect play SOUN 0xZZZZ ZZZZ=sound effect value Fades music out. MUEN 0xZZ ZZ=fade out speed Lowering/Highering volume of the music MUSI (makes music more silent) MUNO (makes music normal after MUSI) Causes map changes. MAC1 0xZZ 0xY MAC2 0xZZ MACE (placed after a bunch of MAC2) MAC3 0xZZ ZZ=map change number Y=0 does them Y=8 undoes them Load map LOMA 0xZZ XX,YY ZZ = Map number XX,YY = Coordinate Giving items to character ITGC 0xPP 0xZZ ITGV 0xZZ (village) ITGM 0xZZ (to main lord) ZZ=item PP=character Money giving MONE 0xZZ 0xMMMM MMMM = Amount of money ZZ=00 village ZZ=01 cutscene Insert custom code CODE $ZZZZZZZZ ZZZZZZZZ = example: either $01020304 or 0x04 0x03 0x02 0x01 both will compile to 04030201 in hex Fill with values FILL *amount of values* *size of value* *value* Execute ASM ASMC $pointer (repeatable) Change unit condition UNCM 0xZZ 0xXX (causes) UNCR 0xZZ 0xXX (reverses) ZZ = character XX = condition values 01 = invicibility 02 = Grayed out 10 = rescuing a unit 20 = being rescued Makes unit disappear and re-appear DISA 0xZZ (disappear) DISA XX,YY REPA 0xZZ (re-appear) REPA XX,YY ZZ = Character XX,YY = Coordinate Make units fight (FE7) FIGH 0xZZ 0xPP $pointer $code ZZ = Attacker PP = Defender code = 00000000 normal, controlled fight Make units fight(FE8) CMDS CMDL Byte1 Byte2 Byte3 Byte4 FIG1 Attacker Defender FIG2 Attacker Defender Kill a character KILL XX,YY KILL 0xZZ ZZ = Character XX,YY = Coordinate Changes units AI CHAI 0xZZ $AI code CHAI XX,YY $AI code ZZ = Character XX,YY = Coordinate Changes characters affiliation (FE6/FE7) CUSI 0xZZ 0xPP ZZ = Character PP = affiliation code Changes characters affiliation (FE8) CUSA 0xZZ to ally (blue) CUSE 0xZZ to enemy (red) CUSN 0xZZ to neutral (green) ZZ = Character Promotes character (FE8) PROM 0xZZ 0xYY ZZ = Character YY = Class to promote to Makes cursor flash(FE6/FE7) CURF XX,YY CURF 0xZZ ZZ = Character XX,YY = Coordinate Cursor manipulation(FE8) Move cursor CUMO 0xZZ CUMO XX,YY ZZ = Character XX,YY = Coordinate Flash cursor CURF 0xTT TT = amount of frames Remove cursor CURE Fadi in/out black FADI 0xZZ FADU 0xZZ ZZ = Speed of the fade-out 01 = slowest possible FF = Fastest possible Fade in/out white FAWI 0xZZ FAWO 0xZZ ZZ = Speed of the fade-out 01 = slowest possible FF = Fastest possible Fade in/out for CG FADICG 0xZZ FADUCG 0xZZ ZZ = Speed of the fade-out 01 = slowest possible FF = Fastest possible Pointer POIN $pointer Go to event GOTO $pointer Executes pointed events and then returns. World map codes: Starts world map data SWMD Changes script color CSCL Load map LWMA 0xZZ XXXX,YYYY WW ZZ = map to load XXXX,YYYY coordinate of top-left corner (pixels) WW = way to load Loads portrait LOPR 0xII 0xPP 0xHP 0xLW 0xST II = portriat local identification number PP = portrait number HP = horizontal position of the portrait LW = Way the portrait is loaded ST = Time to wait before loading the portrait Removes portrait REPR 0xII 0xWR 0xST II and ST = same as in loading WR = way the portrait is removed Display text TEX7 0xTTTT TTTT = text value Puts text box up PTBU Puts text box down PTBD Scrolls text SCRO Clears text window CTEW Puts or moves map sprite CMSP 0xII XXXX,YYYY 0xUU 0xSC 0xIC II = identification number XXXX,YYYY = coordinates pixels UU = class SC = sprite colour, walking speed and camera movement IC = class identification number Removes map sprite RMSP 0xII Identification Lights up world map area LWMC 0xAV AV = area to light Create a flashing dot FLDT 0xII XXXX,YYYY 0xPL II = identification number PL = palette number Fade into a map FAMA XXXX,YYYY 0xZZ ZZ = map to load Rippling efefct RPEF XXXX,YYYY Ends world map data EWMD Purely EA related: Sent a message MESSAGE *messages* Sents a message to normal output. Sent a message if condition fulfilled MESSAGEIF *condition* *messages* Sents a message to normal output if condition is not 0. MESSAGEIFN *condition* *messages* Sents a message to normal output if condition is 0. Category:Documentation Category:Events